import { Application } from 'egg';
import initIO from './io/init';
export default (app: Application) => {
  const { controller, router } = app;

  router.get('/', controller.home.index);

  initIO(app);

  router.get('/login', controller.login.index);
  router.post('/login', controller.user.login);

  router.get('/add', controller.home.add);

  router.resources('user', '/api/user', controller.user);
  router.resources('version', '/api/version', controller.version);


  router.get('/api/version/download', controller.version.download);
  router.get('/api/version/public', controller.version.publicVersion);
  router.post('/api/version/issue', controller.version.issue);
  // app.io.route('chat', (app.io.controller as any).chat.chat);
  // app.io.route('disconnect', (app.io.controller as any).disconnection);
  // app.io.route('get_version_change', controller.versionIO.index);
  // app.io.route('/', controller.versionIO.index);

  // router.get('/api/testSocket', controller.versionIO.testSocket);
  // app.io.route('disconnect', controller.versionIO.disconnection);
};
